package com.inspur.springbootredis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

@SpringBootApplication
@RestController
public class SpringbootRedisApplication {

    @Autowired
    RedisUtil redisUtil;


    public static void main(String[] args) {
        SpringApplication.run(SpringbootRedisApplication.class, args);
    }

    @PostConstruct
    public void test() throws Exception{
        redisUtil.set("name","fengdianlong",5000);
        while (true){
            Thread.sleep(1000);
            System.out.println(redisUtil.get("name"));
        }
    }
}
